#####################################################################################
####
####  Graphs for Term Limits 2nd  R&R
####
#####################################################################################


library (foreign)


##########################################################################
####               Unconditional Models                              #######
##########################################################################


### Graph for Low-Severity Conflict

GraphingDataHawkish <- read.dta("/Users/Jeff/Dropbox/TermLimits/D6/Analysis/Models/Index/Unconditional/Severity/Confounding/PredictedValues.dta")
GraphingDataHawkish2 <- read.dta("/Users/Jeff/Dropbox/TermLimits/D6/Analysis/Models/Index2/Unconditional/Severity/Confounding/PredictedValues.dta")
GraphingDataMil <- read.dta("/Users/Jeff/Dropbox/TermLimits/D6/Analysis/Models/Unconditional/Severity/Confounding/PredictedValues.dta")    



op <- par(mfrow = c(2,3), omi=c(1.25,.5,.25,0))
{
    
par(mai=c(0.3,0.2,0.2,0.2))
plot(c(-.25,1.25),c(0,.1),type="n",xaxt="n", yaxt="n", xlab="", ylab="")
mtext("Pr(Conflict Initiation)", side=2,line=3,cex=1)
axis(1, at=c(0,1), labels=c("Accountable","Term Limited"),cex=1)
axis(2, at=c(0,0.05,.1),cex.axis=1)
mtext("Empirical", side=3,line=1,cex=1)

arrows(0,GraphingDataHawkish$lo1,0, GraphingDataHawkish$hi1,code=3,angle=90,col="black",lwd=1.25)
points(0,GraphingDataHawkish$prob_hat1,pch=15,col="red",cex=1.5)

arrows(1,GraphingDataHawkish$lo4,1, GraphingDataHawkish$hi4,code=3,angle=90,col="black",lwd=1.25)
points(1,GraphingDataHawkish$prob_hat4,pch=18,col="blue",cex=1.5)

       


par(mai=c(0.3,0.2,0.2,0.2))
plot(c(-.25,1.25),c(0,.1),type="n",xaxt="n", yaxt="n", xlab="", ylab="")
axis(1, at=c(0,1), labels=c("Accountable","Term Limited"),cex=1)
axis(2, at=c(0,0.05,.1),cex.axis=1)
mtext("Theoretical", side=3,line=1,cex=1)

arrows(0,GraphingDataHawkish2$lo1,0, GraphingDataHawkish2$hi1,code=3,angle=90,col="black",lwd=1.25)
points(0,GraphingDataHawkish2$prob_hat1,pch=15,col="red",cex=1.5)

arrows(1,GraphingDataHawkish2$lo4,1, GraphingDataHawkish2$hi4,code=3,angle=90,col="black",lwd=1.25)
points(1,GraphingDataHawkish2$prob_hat4,pch=18,col="blue",cex=1.5)




par(mai=c(0.3,0.2,0.2,0.2))
plot(c(-.25,1.25),c(0,.1),type="n",xaxt="n", yaxt="n", xlab="", ylab="")
axis(1, at=c(0,1), labels=c("Accountable","Term Limited"),cex=1)
axis(2, at=c(0,0.05,.1),cex.axis=1)
mtext("Military Service", side=3,line=1,cex=1)

arrows(0,GraphingDataMil$lo1,0, GraphingDataMil$hi1,code=3,angle=90,col="black",lwd=1.25)
points(0,GraphingDataMil$prob_hat1,pch=15,col="red",cex=1.5)

arrows(1,GraphingDataMil$lo4,1, GraphingDataMil$hi4,code=3,angle=90,col="black",lwd=1.25)
points(1,GraphingDataMil$prob_hat4,pch=18,col="blue",cex=1.5)


## Difference ##

par(mai=c(0.2,0.2,0.2,0.2))
plot(c(-.25,1.25),c(-.05,.05),type="n",xaxt="n", yaxt="n", xlab="", ylab="")
mtext("Difference", side=2,line=3,cex=1)
axis(2, at=c(-.05,0,.05),cex.axis=1)
abline(h =0, col="black")

arrows(.5,GraphingDataHawkish$diff_lo1,.5, GraphingDataHawkish$diff_hi1,code=3,angle=90,col="black",lwd=1.25)
points(.5,GraphingDataHawkish$diff_hat1,pch=19,col="black",cex=1.5)




par(mai=c(0.2,0.2,0.2,0.2))
plot(c(-.25,1.25),c(-.05,.05),type="n",xaxt="n", yaxt="n", xlab="", ylab="")
axis(2, at=c(-.05,0,.05),cex.axis=1)
abline(h =0, col="black")

arrows(.5,GraphingDataHawkish2$diff_lo1,.5, GraphingDataHawkish2$diff_hi1,code=3,angle=90,col="black",lwd=1.25)
points(.5,GraphingDataHawkish2$diff_hat1,pch=19,col="black",cex=1.5)


par(mai=c(0.2,0.2,0.2,0.2))
plot(c(-.25,1.25),c(-.05,.05),type="n",xaxt="n", yaxt="n", xlab="", ylab="")
axis(2, at=c(-.05,0,.05),cex.axis=1)
abline(h =0, col="black")

arrows(.5,GraphingDataMil$diff_lo1,.5, GraphingDataMil$diff_hi1,code=3,angle=90,col="black",lwd=1.25)
points(.5,GraphingDataMil$diff_hat1,pch=19,col="black",cex=1.5)
}

par(op)

op <- par(usr=c(0,1,0,1), # Reset the coordinates
          xpd=NA)

legend(.4,.1, c("Electorally Accountable", "Term Limited","Pr(Conflict|Term Limited) - Pr(Conflict|Accountable)","95% Confidence Interval"), bty="n", cex=.75,col=c("red","blue","black","black"),
        lty=c(-1,-1,-1,1),pch=c(15,18,19,-1), ncol=1)






### Graph for High-Severity Conflict

GraphingDataHawkish <- read.dta("/Users/Jeff/Dropbox/TermLimits/D6/Analysis/Models/Index/Unconditional/Severity/Confounding/PredictedValues.dta")
GraphingDataHawkish2 <- read.dta("/Users/Jeff/Dropbox/TermLimits/D6/Analysis/Models/Index2/Unconditional/Severity/Confounding/PredictedValues.dta")
GraphingDataMil <- read.dta("/Users/Jeff/Dropbox/TermLimits/D6/Analysis/Models/Unconditional/Severity/Confounding/PredictedValues.dta")    



op <- par(mfrow = c(2,3), omi=c(1.25,.5,.25,0))
{
    
par(mai=c(0.3,0.2,0.2,0.2))
plot(c(-.25,1.25),c(0,.1),type="n",xaxt="n", yaxt="n", xlab="", ylab="")
mtext("Pr(Conflict Initiation)", side=2,line=3,cex=1)
axis(1, at=c(0,1), labels=c("Accountable","Term Limited"),cex=1)
axis(2, at=c(0,0.05,.1),cex.axis=1)
mtext("Empirical", side=3,line=1,cex=1)

arrows(0,GraphingDataHawkish$lo2,0, GraphingDataHawkish$hi2,code=3,angle=90,col="black",lwd=1.25)
points(0,GraphingDataHawkish$prob_hat2,pch=15,col="red",cex=1.5)

arrows(1,GraphingDataHawkish$lo5,1, GraphingDataHawkish$hi5,code=3,angle=90,col="black",lwd=1.25)
points(1,GraphingDataHawkish$prob_hat5,pch=18,col="blue",cex=1.5)

       


par(mai=c(0.3,0.2,0.2,0.2))
plot(c(-.25,1.25),c(0,.1),type="n",xaxt="n", yaxt="n", xlab="", ylab="")
axis(1, at=c(0,1), labels=c("Accountable","Term Limited"),cex=1)
axis(2, at=c(0,0.05,.1),cex.axis=1)
mtext("Theoretical", side=3,line=1,cex=1)


arrows(0,GraphingDataHawkish2$lo2,0, GraphingDataHawkish2$hi2,code=3,angle=90,col="black",lwd=1.25)
points(0,GraphingDataHawkish2$prob_hat2,pch=15,col="red",cex=1.5)

arrows(1,GraphingDataHawkish2$lo5,1, GraphingDataHawkish2$hi5,code=3,angle=90,col="black",lwd=1.25)
points(1,GraphingDataHawkish2$prob_hat5,pch=18,col="blue",cex=1.5)



par(mai=c(0.3,0.2,0.2,0.2))
plot(c(-.25,1.25),c(0,.1),type="n",xaxt="n", yaxt="n", xlab="", ylab="")
axis(1, at=c(0,1), labels=c("Accountable","Term Limited"),cex=1)
axis(2, at=c(0,0.05,.1),cex.axis=1)
mtext("Military Service", side=3,line=1,cex=1)


arrows(0,GraphingDataMil$lo2,0, GraphingDataMil$hi2,code=3,angle=90,col="black",lwd=1.25)
points(0,GraphingDataMil$prob_hat2,pch=15,col="red",cex=1.5)

arrows(1,GraphingDataMil$lo5,1, GraphingDataMil$hi5,code=3,angle=90,col="black",lwd=1.25)
points(1,GraphingDataMil$prob_hat5,pch=18,col="blue",cex=1.5)




## Difference ##

par(mai=c(0.2,0.2,0.2,0.2))
plot(c(-.25,1.25),c(-.05,.05),type="n",xaxt="n", yaxt="n", xlab="", ylab="")
mtext("Difference", side=2,line=3,cex=1)
axis(2, at=c(-.05,0,.05),cex.axis=1)
abline(h =0, col="black")

arrows(.5,GraphingDataHawkish$diff_lo2,.5, GraphingDataHawkish$diff_hi2,code=3,angle=90,col="black",lwd=1.25)
points(.5,GraphingDataHawkish$diff_hat2,pch=19,col="black",cex=1.5)




par(mai=c(0.2,0.2,0.2,0.2))
plot(c(-.25,1.25),c(-.05,.05),type="n",xaxt="n", yaxt="n", xlab="", ylab="")
axis(2, at=c(-.05,0,.05),cex.axis=1)
abline(h =0, col="black")

arrows(.5,GraphingDataHawkish2$diff_lo2,.5, GraphingDataHawkish2$diff_hi2,code=3,angle=90,col="black",lwd=1.25)
points(.5,GraphingDataHawkish2$diff_hat2,pch=19,col="black",cex=1.5)


par(mai=c(0.2,0.2,0.2,0.2))
plot(c(-.25,1.25),c(-.05,.05),type="n",xaxt="n", yaxt="n", xlab="", ylab="")
axis(2, at=c(-.05,0,.05),cex.axis=1)
abline(h =0, col="black")

arrows(.5,GraphingDataMil$diff_lo2,.5, GraphingDataMil$diff_hi2,code=3,angle=90,col="black",lwd=1.25)
points(.5,GraphingDataMil$diff_hat2,pch=19,col="black",cex=1.5)
}

par(op)

op <- par(usr=c(0,1,0,1), # Reset the coordinates
          xpd=NA)

legend(.4,.1, c("Electorally Accountable", "Term Limited","Pr(Conflict|Term Limited) - Pr(Conflict|Accountable)","95% Confidence Interval"), bty="n", cex=.75,col=c("red","blue","black","black"),
        lty=c(-1,-1,-1,1),pch=c(15,18,19,-1), ncol=1)














##########################################################################
####               Conditional Models                              #######
##########################################################################


## Graph for Additional Controls

GraphingDataHawkish <- read.dta("/Users/Jeff/Dropbox/TermLimits/D6/Analysis/Models/Index/Conditional/Primary/Full/PredictedValues.dta")
GraphingDataHawkish2 <- read.dta("/Users/Jeff/Dropbox/TermLimits/D6/Analysis/Models/Index2/Conditional/Primary/Full/PredictedValues.dta")
GraphingDataMil <- read.dta("/Users/Jeff/Dropbox/TermLimits/D6/Analysis/Models/Conditional/Primary/Full/PredictedValues.dta")

op <- par(mfrow = c(2,3), oma=c(5,2,0,0))
{
    
plot(c(.75,5.25),c(0,.2),type="n",xaxt="n", yaxt="n", xlab="", ylab="")
mtext("Pr(Conflict Initiation)", side=2,line=3,cex=1)
axis(1, at=c(1,5), labels=c("Dove","Hawk"),cex=1)
axis(2, at=c(0,.1, .2),cex.axis=1)
mtext("Theoretical", side=3,line=1,cex=1)

lines(GraphingDataHawkish$ruler,GraphingDataHawkish$prob_hat0,lty=2,lwd=2,col="red")

polygon(x=c(GraphingDataHawkish$ruler, rev(GraphingDataHawkish$ruler)),
        y = c(GraphingDataHawkish$lo0, rev(GraphingDataHawkish$hi0)),
        col=rgb(1,.25,0,.25), border=NA)


lines(GraphingDataHawkish$ruler,GraphingDataHawkish$prob_hat1,lty=3,lwd=2,col="blue")

polygon(x=c(GraphingDataHawkish$ruler, rev(GraphingDataHawkish$ruler)),
        y = c(GraphingDataHawkish$lo1, rev(GraphingDataHawkish$hi1)),
        col=rgb(0,.25,1,.25), border=NA)



plot(c(.75,4.25),c(0,.2),type="n",xaxt="n", yaxt="n", xlab="", ylab="")
axis(1, at=c(1,4), labels=c("Dove","Hawk"),cex=1)
axis(2, at=c(0,.1, .2),cex.axis=1)
mtext("Empirical", side=3,line=1,cex=1)

lines(GraphingDataHawkish2$ruler,GraphingDataHawkish2$prob_hat0,lty=2,lwd=2,col="red")

polygon(x=c(GraphingDataHawkish2$ruler, rev(GraphingDataHawkish2$ruler)),
        y = c(GraphingDataHawkish2$lo0, rev(GraphingDataHawkish2$hi0)),
        col=rgb(1,.25,0,.25), border=NA)


lines(GraphingDataHawkish2$ruler,GraphingDataHawkish2$prob_hat1,lty=3,lwd=2,col="blue")

polygon(x=c(GraphingDataHawkish2$ruler, rev(GraphingDataHawkish2$ruler)),
        y = c(GraphingDataHawkish2$lo1, rev(GraphingDataHawkish2$hi1)),
        col=rgb(0,.25,1,.25), border=NA)





plot(c(-5,5),c(0,.2),type="n",xaxt="n", yaxt="n", xlab="", ylab="")
axis(1, at=c(-2.5,2.5), labels=c("Civilian","Military"),cex=1)
axis(2, at=c(0,.1,.2),cex.axis=1)
mtext("Military Service", side=3,line=1,cex=1)

arrows(-3.5,GraphingDataMil$lo0,-3.5, GraphingDataMil$hi0,code=3,angle=90,col="black",lwd=1)
arrows(-1.5,GraphingDataMil$lo1,-1.5, GraphingDataMil$hi1,code=3,angle=90,col="black",lwd=1)
points(-3.5,GraphingDataMil$prob_hat0,pch=15,col="red",cex=2)
points(-1.5,GraphingDataMil$prob_hat1,pch=18,col="blue",cex=2)

arrows(1.5,GraphingDataMil$lo01,1.5, GraphingDataMil$hi01,code=3,angle=90,col="black",lwd=1)
arrows(3.5,GraphingDataMil$lo11,3.5, GraphingDataMil$hi11,code=3,angle=90,col="black",lwd=1)
points(1.5,GraphingDataMil$prob_hat01,pch=15,col="red",cex=2)
points(3.5,GraphingDataMil$prob_hat11,pch=18,col="blue",cex=2)





plot(c(.75,5.25),c(-.15,.15),type="n",xaxt="n", yaxt="n", xlab="", ylab="")
mtext("Difference", side=2,line=3,cex=1)
axis(1, at=c(1,5), labels=c("Dove","Hawk"),cex=1)
axis(2, at=c(-.1,0,.1),cex.axis=1)
abline(h =0, col="black")

lines(GraphingDataHawkish$ruler,GraphingDataHawkish$diff_hat0 ,lty=1,lwd=2,col="black")
polygon(x=c(GraphingDataHawkish$ruler, rev(GraphingDataHawkish$ruler)),
        y = c(GraphingDataHawkish$diff_lo0, rev(GraphingDataHawkish$diff_hi0)),
        col=rgb(.25,.25,.25,.25), border=NA)




plot(c(.75,4.25),c(-.15,.15),type="n",xaxt="n", yaxt="n", xlab="", ylab="")
axis(1, at=c(1,4), labels=c("Dove","Hawk"),cex=1)
axis(2, at=c(-.1,0,.1),cex.axis=1)
abline(h =0, col="black")

lines(GraphingDataHawkish2$ruler,GraphingDataHawkish2$diff_hat0 ,lty=1,lwd=2,col="black")
polygon(x=c(GraphingDataHawkish2$ruler, rev(GraphingDataHawkish2$ruler)),
        y = c(GraphingDataHawkish2$diff_lo0, rev(GraphingDataHawkish2$diff_hi0)),
        col=rgb(.25,.25,.25,.25), border=NA)





plot(c(-.25,1.25),c(-.15,.15),type="n",xaxt="n", yaxt="n", xlab="", ylab="")
x<-c(-.35,2.2)
y<-c(0,0)
lines (x,y,lty="solid", col="black")
axis(1, at=c(0,1), labels=c("Civilian","Military"),cex=1)
axis(2, at=c(-.1,0,.1),cex.axis=1)


arrows(0,GraphingDataMil$diff_lo0,0, GraphingDataMil$diff_hi0,code=3,angle=90,col="black",lwd=1.25)
points(0,GraphingDataMil$diff_hat0,pch=19,col="black",cex=1.5)

arrows(1,GraphingDataMil$diff_lo01,1, GraphingDataMil$diff_hi01,code=3,angle=90,col="black",lwd=1.25)
points(1,GraphingDataMil$diff_hat01,pch=19,col="black",cex=1.5)




}

par(op)

op <- par(usr=c(0,1,0,1), # Reset the coordinates
          xpd=NA)

legend(.375,.0, c("Electorally Accountable", "Term Limited","Pr(Conflict|Term Limited) - Pr(Conflict|Accountable)"), bty="n", cex=.75,col=c("red","blue","black"),
        lty=c(-1,-1,-1),pch=c(15,18,19), ncol=1)






### Graph for Low-Severity Conflict

GraphingDataHawkish <- read.dta("/Users/Jeff/Dropbox/TermLimits/D6/Analysis/Models/Index/Conditional/Severity/Confounding/PredictedValues.dta")
GraphingDataHawkish2 <- read.dta("/Users/Jeff/Dropbox/TermLimits/D6/Analysis/Models/Index2/Conditional/Severity/Confounding/PredictedValues.dta")
GraphingDataMil <- read.dta("/Users/Jeff/Dropbox/TermLimits/D6/Analysis/Models/Conditional/Severity/Confounding/PredictedValues.dta")

op <- par(mfrow = c(2,3), oma=c(5,2,0,0))
{
    
plot(c(.75,5.25),c(0,.2),type="n",xaxt="n", yaxt="n", xlab="", ylab="")
mtext("Pr(Conflict Initiation)", side=2,line=3,cex=1)
axis(1, at=c(1,5), labels=c("Dove","Hawk"),cex=1)
axis(2, at=c(0,.1, .2),cex.axis=1)
mtext("Theoretical", side=3,line=1,cex=1)

lines(GraphingDataHawkish$ruler,GraphingDataHawkish$prob_hat1,lty=2,lwd=2,col="red")

polygon(x=c(GraphingDataHawkish$ruler, rev(GraphingDataHawkish$ruler)),
        y = c(GraphingDataHawkish$lo1, rev(GraphingDataHawkish$hi1)),
        col=rgb(1,.25,0,.25), border=NA)


lines(GraphingDataHawkish$ruler,GraphingDataHawkish$prob_hat4,lty=3,lwd=2,col="blue")

polygon(x=c(GraphingDataHawkish$ruler, rev(GraphingDataHawkish$ruler)),
        y = c(GraphingDataHawkish$lo4, rev(GraphingDataHawkish$hi4)),
        col=rgb(0,.25,1,.25), border=NA)



plot(c(.75,4.25),c(0,.2),type="n",xaxt="n", yaxt="n", xlab="", ylab="")
axis(1, at=c(1,4), labels=c("Dove","Hawk"),cex=1)
axis(2, at=c(0,.1, .2),cex.axis=1)
mtext("Empirical", side=3,line=1,cex=1)

lines(GraphingDataHawkish2$ruler,GraphingDataHawkish2$prob_hat1,lty=2,lwd=2,col="red")

polygon(x=c(GraphingDataHawkish2$ruler, rev(GraphingDataHawkish2$ruler)),
        y = c(GraphingDataHawkish2$lo1, rev(GraphingDataHawkish2$hi1)),
        col=rgb(1,.25,0,.25), border=NA)


lines(GraphingDataHawkish2$ruler,GraphingDataHawkish2$prob_hat4,lty=3,lwd=2,col="blue")

polygon(x=c(GraphingDataHawkish2$ruler, rev(GraphingDataHawkish2$ruler)),
        y = c(GraphingDataHawkish2$lo4, rev(GraphingDataHawkish2$hi4)),
        col=rgb(0,.25,1,.25), border=NA)





plot(c(-5,5),c(0,.2),type="n",xaxt="n", yaxt="n", xlab="", ylab="")
axis(1, at=c(-2.5,2.5), labels=c("Civilian","Military"),cex=1)
axis(2, at=c(0,.1,.2),cex.axis=1)
mtext("Military Service", side=3,line=1,cex=1)

arrows(-3.5,GraphingDataMil$lo1,-3.5, GraphingDataMil$hi1,code=3,angle=90,col="black",lwd=1)
arrows(-1.5,GraphingDataMil$lo4,-1.5, GraphingDataMil$hi4,code=3,angle=90,col="black",lwd=1)
points(-3.5,GraphingDataMil$prob_hat1,pch=15,col="red",cex=2)
points(-1.5,GraphingDataMil$prob_hat4,pch=18,col="blue",cex=2)

arrows(1.5,GraphingDataMil$lo11,1.5, GraphingDataMil$hi11,code=3,angle=90,col="black",lwd=1)
arrows(3.5,GraphingDataMil$lo41,3.5, GraphingDataMil$hi41,code=3,angle=90,col="black",lwd=1)
points(1.5,GraphingDataMil$prob_hat11,pch=15,col="red",cex=2)
points(3.5,GraphingDataMil$prob_hat41,pch=18,col="blue",cex=2)





plot(c(.75,5.25),c(-.15,.15),type="n",xaxt="n", yaxt="n", xlab="", ylab="")
mtext("Difference", side=2,line=3,cex=1)
axis(1, at=c(1,5), labels=c("Dove","Hawk"),cex=1)
axis(2, at=c(-.1,0,.1),cex.axis=1)
abline(h =0, col="black")

lines(GraphingDataHawkish$ruler,GraphingDataHawkish$diff_hat1 ,lty=1,lwd=2,col="black")
polygon(x=c(GraphingDataHawkish$ruler, rev(GraphingDataHawkish$ruler)),
        y = c(GraphingDataHawkish$diff_lo1, rev(GraphingDataHawkish$diff_hi1)),
        col=rgb(.25,.25,.25,.25), border=NA)




plot(c(.75,4.25),c(-.15,.15),type="n",xaxt="n", yaxt="n", xlab="", ylab="")
axis(1, at=c(1,4), labels=c("Dove","Hawk"),cex=1)
axis(2, at=c(-.1,0,.1),cex.axis=1)
abline(h =0, col="black")

lines(GraphingDataHawkish2$ruler,GraphingDataHawkish2$diff_hat1 ,lty=1,lwd=2,col="black")
polygon(x=c(GraphingDataHawkish2$ruler, rev(GraphingDataHawkish2$ruler)),
        y = c(GraphingDataHawkish2$diff_lo1, rev(GraphingDataHawkish2$diff_hi1)),
        col=rgb(.25,.25,.25,.25), border=NA)





plot(c(-.25,1.25),c(-.15,.15),type="n",xaxt="n", yaxt="n", xlab="", ylab="")
x<-c(-.35,2.2)
y<-c(0,0)
lines (x,y,lty="solid", col="black")
axis(1, at=c(0,1), labels=c("Civilian","Military"),cex=1)
axis(2, at=c(-.1,0,.1),cex.axis=1)


arrows(0,GraphingDataMil$diff_lo1,0, GraphingDataMil$diff_hi1,code=3,angle=90,col="black",lwd=1.25)
points(0,GraphingDataMil$diff_hat1,pch=19,col="black",cex=1.5)

arrows(1,GraphingDataMil$diff_lo11,1, GraphingDataMil$diff_hi11,code=3,angle=90,col="black",lwd=1.25)
points(1,GraphingDataMil$diff_hat11,pch=19,col="black",cex=1.5)


}

par(op)

op <- par(usr=c(0,1,0,1), # Reset the coordinates
          xpd=NA)

legend(.375,.0, c("Electorally Accountable", "Term Limited","Pr(Conflict|Term Limited) - Pr(Conflict|Accountable)"), bty="n", cex=.75,col=c("red","blue","black"),
        lty=c(-1,-1,-1),pch=c(15,18,19), ncol=1)







### Graph for High-Severity Conflict

GraphingDataHawkish <- read.dta("/Users/Jeff/Dropbox/TermLimits/D6/Analysis/Models/Index/Conditional/Severity/Confounding/PredictedValues.dta")
GraphingDataHawkish2 <- read.dta("/Users/Jeff/Dropbox/TermLimits/D6/Analysis/Models/Index2/Conditional/Severity/Confounding/PredictedValues.dta")
GraphingDataMil <- read.dta("/Users/Jeff/Dropbox/TermLimits/D6/Analysis/Models/Conditional/Severity/Confounding/PredictedValues.dta")

op <- par(mfrow = c(2,3), oma=c(5,2,0,0))
{
    
plot(c(.75,5.25),c(0,.1),type="n",xaxt="n", yaxt="n", xlab="", ylab="")
mtext("Pr(Conflict Initiation)", side=2,line=3,cex=1)
axis(1, at=c(1,5), labels=c("Dove","Hawk"),cex=1)
axis(2, at=c(0,.1, .2),cex.axis=1)
mtext("Theoretical", side=3,line=1,cex=1)

lines(GraphingDataHawkish$ruler,GraphingDataHawkish$prob_hat2,lty=2,lwd=2,col="red")

polygon(x=c(GraphingDataHawkish$ruler, rev(GraphingDataHawkish$ruler)),
        y = c(GraphingDataHawkish$lo2, rev(GraphingDataHawkish$hi2)),
        col=rgb(1,.25,0,.25), border=NA)


lines(GraphingDataHawkish$ruler,GraphingDataHawkish$prob_hat5,lty=3,lwd=2,col="blue")

polygon(x=c(GraphingDataHawkish$ruler, rev(GraphingDataHawkish$ruler)),
        y = c(GraphingDataHawkish$lo5, rev(GraphingDataHawkish$hi5)),
        col=rgb(0,.25,1,.25), border=NA)



plot(c(.75,4.25),c(0,.1),type="n",xaxt="n", yaxt="n", xlab="", ylab="")
axis(1, at=c(1,4), labels=c("Dove","Hawk"),cex=1)
axis(2, at=c(0,.1, .2),cex.axis=1)
mtext("Empirical", side=3,line=1,cex=1)

lines(GraphingDataHawkish2$ruler,GraphingDataHawkish2$prob_hat2,lty=2,lwd=2,col="red")

polygon(x=c(GraphingDataHawkish2$ruler, rev(GraphingDataHawkish2$ruler)),
        y = c(GraphingDataHawkish2$lo2, rev(GraphingDataHawkish2$hi2)),
        col=rgb(1,.25,0,.25), border=NA)


lines(GraphingDataHawkish2$ruler,GraphingDataHawkish2$prob_hat5,lty=3,lwd=2,col="blue")

polygon(x=c(GraphingDataHawkish2$ruler, rev(GraphingDataHawkish2$ruler)),
        y = c(GraphingDataHawkish2$lo5, rev(GraphingDataHawkish2$hi5)),
        col=rgb(0,.25,1,.25), border=NA)





plot(c(-5,5),c(0,.1),type="n",xaxt="n", yaxt="n", xlab="", ylab="")
axis(1, at=c(-2.5,2.5), labels=c("Civilian","Military"),cex=1)
axis(2, at=c(0,.1,.2),cex.axis=1)
mtext("Military Service", side=3,line=1,cex=1)

arrows(-3.5,GraphingDataMil$lo2,-3.5, GraphingDataMil$hi2,code=3,angle=90,col="black",lwd=1)
arrows(-1.5,GraphingDataMil$lo5,-1.5, GraphingDataMil$hi5,code=3,angle=90,col="black",lwd=1)
points(-3.5,GraphingDataMil$prob_hat2,pch=15,col="red",cex=2)
points(-1.5,GraphingDataMil$prob_hat5,pch=18,col="blue",cex=2)

arrows(1.5,GraphingDataMil$lo21,1.5, GraphingDataMil$hi21,code=3,angle=90,col="black",lwd=1)
arrows(3.5,GraphingDataMil$lo51,3.5, GraphingDataMil$hi51,code=3,angle=90,col="black",lwd=1)
points(1.5,GraphingDataMil$prob_hat21,pch=15,col="red",cex=2)
points(3.5,GraphingDataMil$prob_hat51,pch=18,col="blue",cex=2)





plot(c(.75,5.25),c(-.05,.05),type="n",xaxt="n", yaxt="n", xlab="", ylab="")
mtext("Difference", side=2,line=3,cex=1)
axis(1, at=c(1,5), labels=c("Dove","Hawk"),cex=1)
axis(2, at=c(-.05,0,.05),cex.axis=1)
abline(h =0, col="black")

lines(GraphingDataHawkish$ruler,GraphingDataHawkish$diff_hat2 ,lty=1,lwd=2,col="black")
polygon(x=c(GraphingDataHawkish$ruler, rev(GraphingDataHawkish$ruler)),
        y = c(GraphingDataHawkish$diff_lo2, rev(GraphingDataHawkish$diff_hi2)),
        col=rgb(.25,.25,.25,.25), border=NA)




plot(c(.75,4.25),c(-.05,.05),type="n",xaxt="n", yaxt="n", xlab="", ylab="")
axis(1, at=c(1,4), labels=c("Dove","Hawk"),cex=1)
axis(2, at=c(-.05,0,.05),cex.axis=1)
abline(h =0, col="black")

lines(GraphingDataHawkish2$ruler,GraphingDataHawkish2$diff_hat2 ,lty=1,lwd=2,col="black")
polygon(x=c(GraphingDataHawkish2$ruler, rev(GraphingDataHawkish2$ruler)),
        y = c(GraphingDataHawkish2$diff_lo2, rev(GraphingDataHawkish2$diff_hi2)),
        col=rgb(.25,.25,.25,.25), border=NA)





plot(c(-.25,1.25),c(-.05,.05),type="n",xaxt="n", yaxt="n", xlab="", ylab="")
x<-c(-.35,2.2)
y<-c(0,0)
lines (x,y,lty="solid", col="black")
axis(1, at=c(0,1), labels=c("Civilian","Military"),cex=1)
axis(2, at=c(-.05,0,.05),cex.axis=1)


arrows(0,GraphingDataMil$diff_lo2,0, GraphingDataMil$diff_hi2,code=3,angle=90,col="black",lwd=1.25)
points(0,GraphingDataMil$diff_hat2,pch=19,col="black",cex=1.5)

arrows(1,GraphingDataMil$diff_lo21,1, GraphingDataMil$diff_hi21,code=3,angle=90,col="black",lwd=1.25)
points(1,GraphingDataMil$diff_hat21,pch=19,col="black",cex=1.5)


}

par(op)

op <- par(usr=c(0,1,0,1), # Reset the coordinates
          xpd=NA)

legend(.375,.0, c("Electorally Accountable", "Term Limited","Pr(Conflict|Term Limited) - Pr(Conflict|Accountable)"), bty="n", cex=.75,col=c("red","blue","black"),
        lty=c(-1,-1,-1),pch=c(15,18,19), ncol=1)











### Graph for Multiple Conflicts

GraphingDataHawkish <- read.dta("/Users/Jeff/Dropbox/TermLimits/D6/Analysis/Models/Index/Conditional/MultipleDisputes/Confounding/PredictedValues.dta")
GraphingDataHawkish2 <- read.dta("/Users/Jeff/Dropbox/TermLimits/D6/Analysis/Models/Index2/Conditional/MultipleDisputes/Confounding/PredictedValues.dta")
GraphingDataMil <- read.dta("/Users/Jeff/Dropbox/TermLimits/D6/Analysis/Models/Conditional/MultipleDisputes/Confounding/PredictedValues.dta")

op <- par(mfrow = c(2,3), oma=c(5,2,0,0))
{
    
plot(c(-1.25,3.25),c(0,.2),type="n",xaxt="n", yaxt="n", xlab="", ylab="")
mtext("Expected(Conflict Initiation)", side=2,line=3,cex=1)
axis(1, at=c(-1,3), labels=c("Dove","Hawk"),cex=1)
axis(2, at=c(0,.1, .2),cex.axis=1)
mtext("Theoretical", side=3,line=1,cex=1)

lines(GraphingDataHawkish$ruler,GraphingDataHawkish$pred_accountable,lty=2,lwd=2,col="red")

polygon(x=c(GraphingDataHawkish$ruler, rev(GraphingDataHawkish$ruler)),
        y = c(GraphingDataHawkish$pred_accountable_low, rev(GraphingDataHawkish$pred_accountable_high)),
        col=rgb(1,.25,0,.25), border=NA)


lines(GraphingDataHawkish$ruler,GraphingDataHawkish$pred_lame,lty=3,lwd=2,col="blue")

polygon(x=c(GraphingDataHawkish$ruler, rev(GraphingDataHawkish$ruler)),
        y = c(GraphingDataHawkish$pred_lame_low, rev(GraphingDataHawkish$pred_lame_high)),
        col=rgb(0,.25,1,.25), border=NA)



plot(c(-.25,3.25),c(0,.2),type="n",xaxt="n", yaxt="n", xlab="", ylab="")
axis(1, at=c(0,3), labels=c("Dove","Hawk"),cex=1)
axis(2, at=c(0,.1, .2),cex.axis=1)
mtext("Empirical", side=3,line=1,cex=1)

lines(GraphingDataHawkish2$ruler,GraphingDataHawkish2$pred_accountable,lty=2,lwd=2,col="red")

polygon(x=c(GraphingDataHawkish2$ruler, rev(GraphingDataHawkish2$ruler)),
        y = c(GraphingDataHawkish2$pred_accountable_low, rev(GraphingDataHawkish2$pred_accountable_high)),
        col=rgb(1,.25,0,.25), border=NA)


lines(GraphingDataHawkish2$ruler,GraphingDataHawkish2$pred_lame,lty=3,lwd=2,col="blue")

polygon(x=c(GraphingDataHawkish2$ruler, rev(GraphingDataHawkish2$ruler)),
        y = c(GraphingDataHawkish2$pred_lame_low, rev(GraphingDataHawkish2$pred_lame_high)),
        col=rgb(0,.25,1,.25), border=NA)





plot(c(-5,5),c(0,.2),type="n",xaxt="n", yaxt="n", xlab="", ylab="")
axis(1, at=c(-2.5,2.5), labels=c("Civilian","Military"),cex=1)
axis(2, at=c(0,.1,.2),cex.axis=1)
mtext("Military Service", side=3,line=1,cex=1)

arrows(-3.5,GraphingDataMil$pred_civ_account_low,-3.5, GraphingDataMil$pred_civ_account_high,code=3,angle=90,col="black",lwd=1)
arrows(-1.5,GraphingDataMil$pred_civ_tl_low,-1.5, GraphingDataMil$pred_civ_tl_high,code=3,angle=90,col="black",lwd=1)
points(-3.5,GraphingDataMil$pred_civ_account,pch=15,col="red",cex=2)
points(-1.5,GraphingDataMil$pred_civ_tl,pch=18,col="blue",cex=2)

arrows(1.5,GraphingDataMil$pred_mil_account_low,1.5, GraphingDataMil$pred_mil_account_high,code=3,angle=90,col="black",lwd=1)
arrows(3.5,GraphingDataMil$pred_mil_tl_low,3.5, GraphingDataMil$pred_mil_tl_high,code=3,angle=90,col="black",lwd=1)
points(1.5,GraphingDataMil$pred_mil_account,pch=15,col="red",cex=2)
points(3.5,GraphingDataMil$pred_mil_tl,pch=18,col="blue",cex=2)





plot(c(-1.25,3.25),c(-.15,.15),type="n",xaxt="n", yaxt="n", xlab="", ylab="")
mtext("Difference", side=2,line=3,cex=1)
axis(1, at=c(-1,3), labels=c("Dove","Hawk"),cex=1)
axis(2, at=c(-.1,0,.1),cex.axis=1)
abline(h =0, col="black")

lines(GraphingDataHawkish$ruler,GraphingDataHawkish$pred_diff ,lty=1,lwd=2,col="black")
polygon(x=c(GraphingDataHawkish$ruler, rev(GraphingDataHawkish$ruler)),
        y = c(GraphingDataHawkish$pred_diff_low, rev(GraphingDataHawkish$pred_diff_high)),
        col=rgb(.25,.25,.25,.25), border=NA)

 


plot(c(-.25,3.25),c(-.15,.15),type="n",xaxt="n", yaxt="n", xlab="", ylab="")
axis(1, at=c(0,3), labels=c("Dove","Hawk"),cex=1)
axis(2, at=c(-.1,0,.1),cex.axis=1)
abline(h =0, col="black")

lines(GraphingDataHawkish2$ruler,GraphingDataHawkish2$pred_diff ,lty=1,lwd=2,col="black")
polygon(x=c(GraphingDataHawkish2$ruler, rev(GraphingDataHawkish2$ruler)),
        y = c(GraphingDataHawkish2$pred_diff_low, rev(GraphingDataHawkish2$pred_diff_high)),
        col=rgb(.25,.25,.25,.25), border=NA)





plot(c(-.25,1.25),c(-.15,.15),type="n",xaxt="n", yaxt="n", xlab="", ylab="")
x<-c(-.35,2.2)
y<-c(0,0)
lines (x,y,lty="solid", col="black")
axis(1, at=c(0,1), labels=c("Civilian","Military"),cex=1)
axis(2, at=c(-.1,0,.1),cex.axis=1)


arrows(0,GraphingDataMil$diff_civ_low,0, GraphingDataMil$diff_civ_high,code=3,angle=90,col="black",lwd=1.25)
points(0,GraphingDataMil$diff_civ_mean,pch=19,col="black",cex=1.5)

arrows(1,GraphingDataMil$diff_mil_low,1, GraphingDataMil$diff_mil_high,code=3,angle=90,col="black",lwd=1.25)
points(1,GraphingDataMil$diff_mil_mean,pch=19,col="black",cex=1.5)

}

par(op)

op <- par(usr=c(0,1,0,1), # Reset the coordinates
          xpd=NA)

legend(.375,.0, c("Electorally Accountable", "Term Limited","Pr(Conflict|Term Limited) - Pr(Conflict|Accountable)"), bty="n", cex=.75,col=c("red","blue","black"),
        lty=c(-1,-1,-1),pch=c(15,18,19), ncol=1)








## Graph for Single Mandate

GraphingDataHawkish <- read.dta("/Users/Jeff/Dropbox/TermLimits/D6/Analysis/Models/Index/Conditional/Mandates/Confounding/PredictedValues.dta")
GraphingDataHawkish2 <- read.dta("/Users/Jeff/Dropbox/TermLimits/D6/Analysis/Models/Index2/Conditional/Mandates/Confounding/PredictedValues.dta")
GraphingDataMil <- read.dta("/Users/Jeff/Dropbox/TermLimits/D6/Analysis/Models/Conditional/Mandates/Confounding/PredictedValues.dta")

op <- par(mfrow = c(2,3), oma=c(5,2,0,0))
{
    
plot(c(.75,5.25),c(0,.25),type="n",xaxt="n", yaxt="n", xlab="", ylab="")
mtext("Pr(Conflict Initiation)", side=2,line=3,cex=1)
axis(1, at=c(1,5), labels=c("Dove","Hawk"),cex=1)
axis(2, at=c(0,.1, .2),cex.axis=1)
mtext("Theoretical", side=3,line=1,cex=1)

lines(GraphingDataHawkish$ruler,GraphingDataHawkish$prob_hat0,lty=2,lwd=2,col="red")

polygon(x=c(GraphingDataHawkish$ruler, rev(GraphingDataHawkish$ruler)),
        y = c(GraphingDataHawkish$lo0, rev(GraphingDataHawkish$hi0)),
        col=rgb(1,.25,0,.25), border=NA)


lines(GraphingDataHawkish$ruler,GraphingDataHawkish$prob_hat1,lty=3,lwd=2,col="blue")

polygon(x=c(GraphingDataHawkish$ruler, rev(GraphingDataHawkish$ruler)),
        y = c(GraphingDataHawkish$lo1, rev(GraphingDataHawkish$hi1)),
        col=rgb(0,.25,1,.25), border=NA)



plot(c(.75,4.25),c(0,.25),type="n",xaxt="n", yaxt="n", xlab="", ylab="")
axis(1, at=c(1,4), labels=c("Dove","Hawk"),cex=1)
axis(2, at=c(0,.1, .2),cex.axis=1)
mtext("Empirical", side=3,line=1,cex=1)

lines(GraphingDataHawkish2$ruler,GraphingDataHawkish2$prob_hat0,lty=2,lwd=2,col="red")

polygon(x=c(GraphingDataHawkish2$ruler, rev(GraphingDataHawkish2$ruler)),
        y = c(GraphingDataHawkish2$lo0, rev(GraphingDataHawkish2$hi0)),
        col=rgb(1,.25,0,.25), border=NA)


lines(GraphingDataHawkish2$ruler,GraphingDataHawkish2$prob_hat1,lty=3,lwd=2,col="blue")

polygon(x=c(GraphingDataHawkish2$ruler, rev(GraphingDataHawkish2$ruler)),
        y = c(GraphingDataHawkish2$lo1, rev(GraphingDataHawkish2$hi1)),
        col=rgb(0,.25,1,.25), border=NA)





plot(c(-5,5),c(0,.25),type="n",xaxt="n", yaxt="n", xlab="", ylab="")
axis(1, at=c(-2.5,2.5), labels=c("Civilian","Military"),cex=1)
axis(2, at=c(0,.1,.2),cex.axis=1)
mtext("Military Service", side=3,line=1,cex=1)

arrows(-3.5,GraphingDataMil$lo0,-3.5, GraphingDataMil$hi0,code=3,angle=90,col="black",lwd=1)
arrows(-1.5,GraphingDataMil$lo1,-1.5, GraphingDataMil$hi1,code=3,angle=90,col="black",lwd=1)
points(-3.5,GraphingDataMil$prob_hat0,pch=15,col="red",cex=2)
points(-1.5,GraphingDataMil$prob_hat1,pch=18,col="blue",cex=2)

arrows(1.5,GraphingDataMil$lo01,1.5, GraphingDataMil$hi01,code=3,angle=90,col="black",lwd=1)
arrows(3.5,GraphingDataMil$lo11,3.5, GraphingDataMil$hi11,code=3,angle=90,col="black",lwd=1)
points(1.5,GraphingDataMil$prob_hat01,pch=15,col="red",cex=2)
points(3.5,GraphingDataMil$prob_hat11,pch=18,col="blue",cex=2)





plot(c(.75,5.25),c(-.15,.15),type="n",xaxt="n", yaxt="n", xlab="", ylab="")
mtext("Difference", side=2,line=3,cex=1)
axis(1, at=c(1,5), labels=c("Dove","Hawk"),cex=1)
axis(2, at=c(-.1,0,.1),cex.axis=1)
abline(h =0, col="black")

lines(GraphingDataHawkish$ruler,GraphingDataHawkish$diff_hat0 ,lty=1,lwd=2,col="black")
polygon(x=c(GraphingDataHawkish$ruler, rev(GraphingDataHawkish$ruler)),
        y = c(GraphingDataHawkish$diff_lo0, rev(GraphingDataHawkish$diff_hi0)),
        col=rgb(.25,.25,.25,.25), border=NA)




plot(c(.75,4.25),c(-.15,.15),type="n",xaxt="n", yaxt="n", xlab="", ylab="")
axis(1, at=c(1,4), labels=c("Dove","Hawk"),cex=1)
axis(2, at=c(-.1,0,.1),cex.axis=1)
abline(h =0, col="black")

lines(GraphingDataHawkish2$ruler,GraphingDataHawkish2$diff_hat0 ,lty=1,lwd=2,col="black")
polygon(x=c(GraphingDataHawkish2$ruler, rev(GraphingDataHawkish2$ruler)),
        y = c(GraphingDataHawkish2$diff_lo0, rev(GraphingDataHawkish2$diff_hi0)),
        col=rgb(.25,.25,.25,.25), border=NA)





plot(c(-.25,1.25),c(-.15,.15),type="n",xaxt="n", yaxt="n", xlab="", ylab="")
x<-c(-.35,2.2)
y<-c(0,0)
lines (x,y,lty="solid", col="black")
axis(1, at=c(0,1), labels=c("Civilian","Military"),cex=1)
axis(2, at=c(-.1,0,.1),cex.axis=1)


arrows(0,GraphingDataMil$diff_lo0,0, GraphingDataMil$diff_hi0,code=3,angle=90,col="black",lwd=1.25)
points(0,GraphingDataMil$diff_hat0,pch=19,col="black",cex=1.5)

arrows(1,GraphingDataMil$diff_lo01,1, GraphingDataMil$diff_hi01,code=3,angle=90,col="black",lwd=1.25)
points(1,GraphingDataMil$diff_hat01,pch=19,col="black",cex=1.5)




}

par(op)

op <- par(usr=c(0,1,0,1), # Reset the coordinates
          xpd=NA)

legend(.375,.0, c("Electorally Accountable", "Term Limited","Pr(Conflict|Term Limited) - Pr(Conflict|Accountable)"), bty="n", cex=.75,col=c("red","blue","black"),
        lty=c(-1,-1,-1),pch=c(15,18,19), ncol=1)









## Graph for Multiple Mandates

GraphingDataHawkish <- read.dta("/Users/Jeff/Dropbox/TermLimits/D6/Analysis/Models/Index/Conditional/Mandates/Confounding/PredictedValues.dta")
GraphingDataHawkish2 <- read.dta("/Users/Jeff/Dropbox/TermLimits/D6/Analysis/Models/Index2/Conditional/Mandates/Confounding/PredictedValues.dta")
GraphingDataMil <- read.dta("/Users/Jeff/Dropbox/TermLimits/D6/Analysis/Models/Conditional/Mandates/Confounding/PredictedValues.dta")

op <- par(mfrow = c(2,3), oma=c(5,2,0,0))
{
    
plot(c(.75,5.25),c(0,.3),type="n",xaxt="n", yaxt="n", xlab="", ylab="")
mtext("Pr(Conflict Initiation)", side=2,line=3,cex=1)
axis(1, at=c(1,5), labels=c("Dove","Hawk"),cex=1)
axis(2, at=c(0,.1, .2),cex.axis=1)
mtext("Theoretical", side=3,line=1,cex=1)

lines(GraphingDataHawkish$ruler,GraphingDataHawkish$prob_hat0,lty=2,lwd=2,col="red")

polygon(x=c(GraphingDataHawkish$ruler, rev(GraphingDataHawkish$ruler)),
        y = c(GraphingDataHawkish$lo0, rev(GraphingDataHawkish$hi0)),
        col=rgb(1,.25,0,.25), border=NA)


lines(GraphingDataHawkish$ruler,GraphingDataHawkish$prob_hat2,lty=3,lwd=2,col="blue")

polygon(x=c(GraphingDataHawkish$ruler, rev(GraphingDataHawkish$ruler)),
        y = c(GraphingDataHawkish$lo2, rev(GraphingDataHawkish$hi2)),
        col=rgb(0,.25,1,.25), border=NA)



plot(c(.75,4.25),c(0,.3),type="n",xaxt="n", yaxt="n", xlab="", ylab="")
axis(1, at=c(1,4), labels=c("Dove","Hawk"),cex=1)
axis(2, at=c(0,.1, .2),cex.axis=1)
mtext("Empirical", side=3,line=1,cex=1)

lines(GraphingDataHawkish2$ruler,GraphingDataHawkish2$prob_hat0,lty=2,lwd=2,col="red")

polygon(x=c(GraphingDataHawkish2$ruler, rev(GraphingDataHawkish2$ruler)),
        y = c(GraphingDataHawkish2$lo0, rev(GraphingDataHawkish2$hi0)),
        col=rgb(1,.25,0,.25), border=NA)


lines(GraphingDataHawkish2$ruler,GraphingDataHawkish2$prob_hat2,lty=3,lwd=2,col="blue")

polygon(x=c(GraphingDataHawkish2$ruler, rev(GraphingDataHawkish2$ruler)),
        y = c(GraphingDataHawkish2$lo2, rev(GraphingDataHawkish2$hi2)),
        col=rgb(0,.25,1,.25), border=NA)





plot(c(-5,5),c(0,.3),type="n",xaxt="n", yaxt="n", xlab="", ylab="")
axis(1, at=c(-2.5,2.5), labels=c("Civilian","Military"),cex=1)
axis(2, at=c(0,.1,.2),cex.axis=1)
mtext("Military Service", side=3,line=1,cex=1)

arrows(-3.5,GraphingDataMil$lo0,-3.5, GraphingDataMil$hi0,code=3,angle=90,col="black",lwd=1)
arrows(-1.5,GraphingDataMil$lo2,-1.5, GraphingDataMil$hi2,code=3,angle=90,col="black",lwd=1)
points(-3.5,GraphingDataMil$prob_hat0,pch=15,col="red",cex=2)
points(-1.5,GraphingDataMil$prob_hat2,pch=18,col="blue",cex=2)

arrows(1.5,GraphingDataMil$lo01,1.5, GraphingDataMil$hi01,code=3,angle=90,col="black",lwd=1)
arrows(3.5,GraphingDataMil$lo21,3.5, GraphingDataMil$hi21,code=3,angle=90,col="black",lwd=1)
points(1.5,GraphingDataMil$prob_hat01,pch=15,col="red",cex=2)
points(3.5,GraphingDataMil$prob_hat21,pch=18,col="blue",cex=2)





plot(c(.75,5.25),c(-.25,.25),type="n",xaxt="n", yaxt="n", xlab="", ylab="")
mtext("Difference", side=2,line=3,cex=1)
axis(1, at=c(1,5), labels=c("Dove","Hawk"),cex=1)
axis(2, at=c(-.15,0,.15),cex.axis=1)
abline(h =0, col="black")

lines(GraphingDataHawkish$ruler,GraphingDataHawkish$diff_hat1 ,lty=1,lwd=2,col="black")
polygon(x=c(GraphingDataHawkish$ruler, rev(GraphingDataHawkish$ruler)),
        y = c(GraphingDataHawkish$diff_lo1, rev(GraphingDataHawkish$diff_hi1)),
        col=rgb(.25,.25,.25,.25), border=NA)




plot(c(.75,4.25),c(-.25,.25),type="n",xaxt="n", yaxt="n", xlab="", ylab="")
axis(1, at=c(1,4), labels=c("Dove","Hawk"),cex=1)
axis(2, at=c(-.15,0,.15),cex.axis=1)
abline(h =0, col="black")

lines(GraphingDataHawkish2$ruler,GraphingDataHawkish2$diff_hat1 ,lty=1,lwd=2,col="black")
polygon(x=c(GraphingDataHawkish2$ruler, rev(GraphingDataHawkish2$ruler)),
        y = c(GraphingDataHawkish2$diff_lo1, rev(GraphingDataHawkish2$diff_hi1)),
        col=rgb(.25,.25,.25,.25), border=NA)





plot(c(-.25,1.25),c(-.25,.25),type="n",xaxt="n", yaxt="n", xlab="", ylab="")
x<-c(-.35,2.2)
y<-c(0,0)
lines (x,y,lty="solid", col="black")
axis(1, at=c(0,1), labels=c("Civilian","Military"),cex=1)
axis(2, at=c(-.15,0,.15),cex.axis=1)


arrows(0,GraphingDataMil$diff_lo1,0, GraphingDataMil$diff_hi1,code=3,angle=90,col="black",lwd=1.25)
points(0,GraphingDataMil$diff_hat1,pch=19,col="black",cex=1.5)

arrows(1,GraphingDataMil$diff_lo11,1, GraphingDataMil$diff_hi11,code=3,angle=90,col="black",lwd=1.25)
points(1,GraphingDataMil$diff_hat11,pch=19,col="black",cex=1.5)




}

par(op)

op <- par(usr=c(0,1,0,1), # Reset the coordinates
          xpd=NA)

legend(.375,.0, c("Electorally Accountable", "Term Limited","Pr(Conflict|Term Limited) - Pr(Conflict|Accountable)"), bty="n", cex=.75,col=c("red","blue","black"),
        lty=c(-1,-1,-1),pch=c(15,18,19), ncol=1)







## Graph for Lagged Variables

GraphingDataHawkish <- read.dta("/Users/Jeff/Dropbox/TermLimits/D6/Analysis/Models/Index/Conditional/LaggedVariables/Confounding/PredictedValues.dta")
GraphingDataHawkish2 <- read.dta("/Users/Jeff/Dropbox/TermLimits/D6/Analysis/Models/Index2/Conditional/LaggedVariables/Confounding/PredictedValues.dta")
GraphingDataMil <- read.dta("/Users/Jeff/Dropbox/TermLimits/D6/Analysis/Models/Conditional/LaggedVariables/Confounding/PredictedValues.dta")

op <- par(mfrow = c(2,3), oma=c(5,2,0,0))
{
    
plot(c(.75,5.25),c(0,.2),type="n",xaxt="n", yaxt="n", xlab="", ylab="")
mtext("Pr(Conflict Initiation)", side=2,line=3,cex=1)
axis(1, at=c(1,5), labels=c("Dove","Hawk"),cex=1)
axis(2, at=c(0,.1, .2),cex.axis=1)
mtext("Theoretical", side=3,line=1,cex=1)

lines(GraphingDataHawkish$ruler,GraphingDataHawkish$prob_hat0,lty=2,lwd=2,col="red")

polygon(x=c(GraphingDataHawkish$ruler, rev(GraphingDataHawkish$ruler)),
        y = c(GraphingDataHawkish$lo0, rev(GraphingDataHawkish$hi0)),
        col=rgb(1,.25,0,.25), border=NA)


lines(GraphingDataHawkish$ruler,GraphingDataHawkish$prob_hat1,lty=3,lwd=2,col="blue")

polygon(x=c(GraphingDataHawkish$ruler, rev(GraphingDataHawkish$ruler)),
        y = c(GraphingDataHawkish$lo1, rev(GraphingDataHawkish$hi1)),
        col=rgb(0,.25,1,.25), border=NA)



plot(c(.75,4.25),c(0,.2),type="n",xaxt="n", yaxt="n", xlab="", ylab="")
axis(1, at=c(1,4), labels=c("Dove","Hawk"),cex=1)
axis(2, at=c(0,.1, .2),cex.axis=1)
mtext("Empirical", side=3,line=1,cex=1)

lines(GraphingDataHawkish2$ruler,GraphingDataHawkish2$prob_hat0,lty=2,lwd=2,col="red")

polygon(x=c(GraphingDataHawkish2$ruler, rev(GraphingDataHawkish2$ruler)),
        y = c(GraphingDataHawkish2$lo0, rev(GraphingDataHawkish2$hi0)),
        col=rgb(1,.25,0,.25), border=NA)


lines(GraphingDataHawkish2$ruler,GraphingDataHawkish2$prob_hat1,lty=3,lwd=2,col="blue")

polygon(x=c(GraphingDataHawkish2$ruler, rev(GraphingDataHawkish2$ruler)),
        y = c(GraphingDataHawkish2$lo1, rev(GraphingDataHawkish2$hi1)),
        col=rgb(0,.25,1,.25), border=NA)





plot(c(-5,5),c(0,.2),type="n",xaxt="n", yaxt="n", xlab="", ylab="")
axis(1, at=c(-2.5,2.5), labels=c("Civilian","Military"),cex=1)
axis(2, at=c(0,.1,.2),cex.axis=1)
mtext("Military Service", side=3,line=1,cex=1)

arrows(-3.5,GraphingDataMil$lo0,-3.5, GraphingDataMil$hi0,code=3,angle=90,col="black",lwd=1)
arrows(-1.5,GraphingDataMil$lo1,-1.5, GraphingDataMil$hi1,code=3,angle=90,col="black",lwd=1)
points(-3.5,GraphingDataMil$prob_hat0,pch=15,col="red",cex=2)
points(-1.5,GraphingDataMil$prob_hat1,pch=18,col="blue",cex=2)

arrows(1.5,GraphingDataMil$lo01,1.5, GraphingDataMil$hi01,code=3,angle=90,col="black",lwd=1)
arrows(3.5,GraphingDataMil$lo11,3.5, GraphingDataMil$hi11,code=3,angle=90,col="black",lwd=1)
points(1.5,GraphingDataMil$prob_hat01,pch=15,col="red",cex=2)
points(3.5,GraphingDataMil$prob_hat11,pch=18,col="blue",cex=2)





plot(c(.75,5.25),c(-.15,.15),type="n",xaxt="n", yaxt="n", xlab="", ylab="")
mtext("Difference", side=2,line=3,cex=1)
axis(1, at=c(1,5), labels=c("Dove","Hawk"),cex=1)
axis(2, at=c(-.1,0,.1),cex.axis=1)
abline(h =0, col="black")

lines(GraphingDataHawkish$ruler,GraphingDataHawkish$diff_hat0 ,lty=1,lwd=2,col="black")
polygon(x=c(GraphingDataHawkish$ruler, rev(GraphingDataHawkish$ruler)),
        y = c(GraphingDataHawkish$diff_lo0, rev(GraphingDataHawkish$diff_hi0)),
        col=rgb(.25,.25,.25,.25), border=NA)




plot(c(.75,4.25),c(-.15,.15),type="n",xaxt="n", yaxt="n", xlab="", ylab="")
axis(1, at=c(1,4), labels=c("Dove","Hawk"),cex=1)
axis(2, at=c(-.1,0,.1),cex.axis=1)
abline(h =0, col="black")

lines(GraphingDataHawkish2$ruler,GraphingDataHawkish2$diff_hat0 ,lty=1,lwd=2,col="black")
polygon(x=c(GraphingDataHawkish2$ruler, rev(GraphingDataHawkish2$ruler)),
        y = c(GraphingDataHawkish2$diff_lo0, rev(GraphingDataHawkish2$diff_hi0)),
        col=rgb(.25,.25,.25,.25), border=NA)





plot(c(-.25,1.25),c(-.15,.15),type="n",xaxt="n", yaxt="n", xlab="", ylab="")
x<-c(-.35,2.2)
y<-c(0,0)
lines (x,y,lty="solid", col="black")
axis(1, at=c(0,1), labels=c("Civilian","Military"),cex=1)
axis(2, at=c(-.1,0,.1),cex.axis=1)


arrows(0,GraphingDataMil$diff_lo0,0, GraphingDataMil$diff_hi0,code=3,angle=90,col="black",lwd=1.25)
points(0,GraphingDataMil$diff_hat0,pch=19,col="black",cex=1.5)

arrows(1,GraphingDataMil$diff_lo01,1, GraphingDataMil$diff_hi01,code=3,angle=90,col="black",lwd=1.25)
points(1,GraphingDataMil$diff_hat01,pch=19,col="black",cex=1.5)




}

par(op)

op <- par(usr=c(0,1,0,1), # Reset the coordinates
          xpd=NA)

legend(.375,.0, c("Electorally Accountable", "Term Limited","Pr(Conflict|Term Limited) - Pr(Conflict|Accountable)"), bty="n", cex=.75,col=c("red","blue","black"),
        lty=c(-1,-1,-1),pch=c(15,18,19), ncol=1)








## Graph for Time Trend

GraphingDataHawkish <- read.dta("/Users/Jeff/Dropbox/TermLimits/D6/Analysis/Models/Index/Conditional/TimeTrend/Confounding/PredictedValues.dta")
GraphingDataHawkish2 <- read.dta("/Users/Jeff/Dropbox/TermLimits/D6/Analysis/Models/Index2/Conditional/TimeTrend/Confounding/PredictedValues.dta")
GraphingDataMil <- read.dta("/Users/Jeff/Dropbox/TermLimits/D6/Analysis/Models/Conditional/TimeTrend/Confounding/PredictedValues.dta")

op <- par(mfrow = c(2,3), oma=c(5,2,0,0))
{
    
plot(c(.75,5.25),c(0,.2),type="n",xaxt="n", yaxt="n", xlab="", ylab="")
mtext("Pr(Conflict Initiation)", side=2,line=3,cex=1)
axis(1, at=c(1,5), labels=c("Dove","Hawk"),cex=1)
axis(2, at=c(0,.1, .2),cex.axis=1)
mtext("Theoretical", side=3,line=1,cex=1)

lines(GraphingDataHawkish$ruler,GraphingDataHawkish$prob_hat0,lty=2,lwd=2,col="red")

polygon(x=c(GraphingDataHawkish$ruler, rev(GraphingDataHawkish$ruler)),
        y = c(GraphingDataHawkish$lo0, rev(GraphingDataHawkish$hi0)),
        col=rgb(1,.25,0,.25), border=NA)


lines(GraphingDataHawkish$ruler,GraphingDataHawkish$prob_hat1,lty=3,lwd=2,col="blue")

polygon(x=c(GraphingDataHawkish$ruler, rev(GraphingDataHawkish$ruler)),
        y = c(GraphingDataHawkish$lo1, rev(GraphingDataHawkish$hi1)),
        col=rgb(0,.25,1,.25), border=NA)



plot(c(.75,4.25),c(0,.2),type="n",xaxt="n", yaxt="n", xlab="", ylab="")
axis(1, at=c(1,4), labels=c("Dove","Hawk"),cex=1)
axis(2, at=c(0,.1, .2),cex.axis=1)
mtext("Empirical", side=3,line=1,cex=1)

lines(GraphingDataHawkish2$ruler,GraphingDataHawkish2$prob_hat0,lty=2,lwd=2,col="red")

polygon(x=c(GraphingDataHawkish2$ruler, rev(GraphingDataHawkish2$ruler)),
        y = c(GraphingDataHawkish2$lo0, rev(GraphingDataHawkish2$hi0)),
        col=rgb(1,.25,0,.25), border=NA)


lines(GraphingDataHawkish2$ruler,GraphingDataHawkish2$prob_hat1,lty=3,lwd=2,col="blue")

polygon(x=c(GraphingDataHawkish2$ruler, rev(GraphingDataHawkish2$ruler)),
        y = c(GraphingDataHawkish2$lo1, rev(GraphingDataHawkish2$hi1)),
        col=rgb(0,.25,1,.25), border=NA)





plot(c(-5,5),c(0,.2),type="n",xaxt="n", yaxt="n", xlab="", ylab="")
axis(1, at=c(-2.5,2.5), labels=c("Civilian","Military"),cex=1)
axis(2, at=c(0,.1,.2),cex.axis=1)
mtext("Military Service", side=3,line=1,cex=1)

arrows(-3.5,GraphingDataMil$lo0,-3.5, GraphingDataMil$hi0,code=3,angle=90,col="black",lwd=1)
arrows(-1.5,GraphingDataMil$lo1,-1.5, GraphingDataMil$hi1,code=3,angle=90,col="black",lwd=1)
points(-3.5,GraphingDataMil$prob_hat0,pch=15,col="red",cex=2)
points(-1.5,GraphingDataMil$prob_hat1,pch=18,col="blue",cex=2)

arrows(1.5,GraphingDataMil$lo01,1.5, GraphingDataMil$hi01,code=3,angle=90,col="black",lwd=1)
arrows(3.5,GraphingDataMil$lo11,3.5, GraphingDataMil$hi11,code=3,angle=90,col="black",lwd=1)
points(1.5,GraphingDataMil$prob_hat01,pch=15,col="red",cex=2)
points(3.5,GraphingDataMil$prob_hat11,pch=18,col="blue",cex=2)





plot(c(.75,5.25),c(-.15,.15),type="n",xaxt="n", yaxt="n", xlab="", ylab="")
mtext("Difference", side=2,line=3,cex=1)
axis(1, at=c(1,5), labels=c("Dove","Hawk"),cex=1)
axis(2, at=c(-.1,0,.1),cex.axis=1)
abline(h =0, col="black")

lines(GraphingDataHawkish$ruler,GraphingDataHawkish$diff_hat0 ,lty=1,lwd=2,col="black")
polygon(x=c(GraphingDataHawkish$ruler, rev(GraphingDataHawkish$ruler)),
        y = c(GraphingDataHawkish$diff_lo0, rev(GraphingDataHawkish$diff_hi0)),
        col=rgb(.25,.25,.25,.25), border=NA)




plot(c(.75,4.25),c(-.15,.15),type="n",xaxt="n", yaxt="n", xlab="", ylab="")
axis(1, at=c(1,4), labels=c("Dove","Hawk"),cex=1)
axis(2, at=c(-.1,0,.1),cex.axis=1)
abline(h =0, col="black")

lines(GraphingDataHawkish2$ruler,GraphingDataHawkish2$diff_hat0 ,lty=1,lwd=2,col="black")
polygon(x=c(GraphingDataHawkish2$ruler, rev(GraphingDataHawkish2$ruler)),
        y = c(GraphingDataHawkish2$diff_lo0, rev(GraphingDataHawkish2$diff_hi0)),
        col=rgb(.25,.25,.25,.25), border=NA)





plot(c(-.25,1.25),c(-.15,.15),type="n",xaxt="n", yaxt="n", xlab="", ylab="")
x<-c(-.35,2.2)
y<-c(0,0)
lines (x,y,lty="solid", col="black")
axis(1, at=c(0,1), labels=c("Civilian","Military"),cex=1)
axis(2, at=c(-.1,0,.1),cex.axis=1)


arrows(0,GraphingDataMil$diff_lo0,0, GraphingDataMil$diff_hi0,code=3,angle=90,col="black",lwd=1.25)
points(0,GraphingDataMil$diff_hat0,pch=19,col="black",cex=1.5)

arrows(1,GraphingDataMil$diff_lo01,1, GraphingDataMil$diff_hi01,code=3,angle=90,col="black",lwd=1.25)
points(1,GraphingDataMil$diff_hat01,pch=19,col="black",cex=1.5)




}

par(op)

op <- par(usr=c(0,1,0,1), # Reset the coordinates
          xpd=NA)

legend(.375,.0, c("Electorally Accountable", "Term Limited","Pr(Conflict|Term Limited) - Pr(Conflict|Accountable)"), bty="n", cex=.75,col=c("red","blue","black"),
        lty=c(-1,-1,-1),pch=c(15,18,19), ncol=1)








## Graph for Year Fixed Effects

GraphingDataHawkish <- read.dta("/Users/Jeff/Dropbox/TermLimits/D6/Analysis/Models/Index/Conditional/FixedEffects/Year/Confounding/PredictedValues.dta")
GraphingDataHawkish2 <- read.dta("/Users/Jeff/Dropbox/TermLimits/D6/Analysis/Models/Index2/Conditional/FixedEffects/Year/Confounding/PredictedValues.dta")
GraphingDataMil <- read.dta("/Users/Jeff/Dropbox/TermLimits/D6/Analysis/Models/Conditional/FixedEffects/Year/Confounding/PredictedValues.dta")

op <- par(mfrow = c(2,3), oma=c(5,2,0,0))
{
    
plot(c(.75,5.25),c(0,.8),type="n",xaxt="n", yaxt="n", xlab="", ylab="")
mtext("Pr(Conflict Initiation)", side=2,line=3,cex=1)
axis(1, at=c(1,5), labels=c("Dove","Hawk"),cex=1)
axis(2, at=c(0,.4,.8),cex.axis=1)
mtext("Theoretical", side=3,line=1,cex=1)

lines(GraphingDataHawkish$ruler,GraphingDataHawkish$prob_hat0,lty=2,lwd=2,col="red")

polygon(x=c(GraphingDataHawkish$ruler, rev(GraphingDataHawkish$ruler)),
        y = c(GraphingDataHawkish$lo0, rev(GraphingDataHawkish$hi0)),
        col=rgb(1,.25,0,.25), border=NA)


lines(GraphingDataHawkish$ruler,GraphingDataHawkish$prob_hat1,lty=3,lwd=2,col="blue")

polygon(x=c(GraphingDataHawkish$ruler, rev(GraphingDataHawkish$ruler)),
        y = c(GraphingDataHawkish$lo1, rev(GraphingDataHawkish$hi1)),
        col=rgb(0,.25,1,.25), border=NA)



plot(c(.75,4.25),c(0,.8),type="n",xaxt="n", yaxt="n", xlab="", ylab="")
axis(1, at=c(1,4), labels=c("Dove","Hawk"),cex=1)
axis(2, at=c(0,.4,.8),cex.axis=1)
mtext("Empirical", side=3,line=1,cex=1)

lines(GraphingDataHawkish2$ruler,GraphingDataHawkish2$prob_hat0,lty=2,lwd=2,col="red")

polygon(x=c(GraphingDataHawkish2$ruler, rev(GraphingDataHawkish2$ruler)),
        y = c(GraphingDataHawkish2$lo0, rev(GraphingDataHawkish2$hi0)),
        col=rgb(1,.25,0,.25), border=NA)


lines(GraphingDataHawkish2$ruler,GraphingDataHawkish2$prob_hat1,lty=3,lwd=2,col="blue")

polygon(x=c(GraphingDataHawkish2$ruler, rev(GraphingDataHawkish2$ruler)),
        y = c(GraphingDataHawkish2$lo1, rev(GraphingDataHawkish2$hi1)),
        col=rgb(0,.25,1,.25), border=NA)





plot(c(-5,5),c(0,.8),type="n",xaxt="n", yaxt="n", xlab="", ylab="")
axis(1, at=c(-2.5,2.5), labels=c("Civilian","Military"),cex=1)
axis(2, at=c(0,.4,.8),cex.axis=1)
mtext("Military Service", side=3,line=1,cex=1)

arrows(-3.5,GraphingDataMil$lo0,-3.5, GraphingDataMil$hi0,code=3,angle=90,col="black",lwd=1)
arrows(-1.5,GraphingDataMil$lo1,-1.5, GraphingDataMil$hi1,code=3,angle=90,col="black",lwd=1)
points(-3.5,GraphingDataMil$prob_hat0,pch=15,col="red",cex=2)
points(-1.5,GraphingDataMil$prob_hat1,pch=18,col="blue",cex=2)

arrows(1.5,GraphingDataMil$lo01,1.5, GraphingDataMil$hi01,code=3,angle=90,col="black",lwd=1)
arrows(3.5,GraphingDataMil$lo11,3.5, GraphingDataMil$hi11,code=3,angle=90,col="black",lwd=1)
points(1.5,GraphingDataMil$prob_hat01,pch=15,col="red",cex=2)
points(3.5,GraphingDataMil$prob_hat11,pch=18,col="blue",cex=2)





plot(c(.75,5.25),c(-.6,.6),type="n",xaxt="n", yaxt="n", xlab="", ylab="")
mtext("Difference", side=2,line=3,cex=1)
axis(1, at=c(1,5), labels=c("Dove","Hawk"),cex=1)
axis(2, at=c(-.5,0,.5),cex.axis=1)
abline(h =0, col="black")

lines(GraphingDataHawkish$ruler,GraphingDataHawkish$diff_hat0 ,lty=1,lwd=2,col="black")
polygon(x=c(GraphingDataHawkish$ruler, rev(GraphingDataHawkish$ruler)),
        y = c(GraphingDataHawkish$diff_lo0, rev(GraphingDataHawkish$diff_hi0)),
        col=rgb(.25,.25,.25,.25), border=NA)




plot(c(.75,4.25),c(-.6,.6),type="n",xaxt="n", yaxt="n", xlab="", ylab="")
axis(1, at=c(1,4), labels=c("Dove","Hawk"),cex=1)
axis(2, at=c(-.5,0,.5),cex.axis=1)
abline(h =0, col="black")

lines(GraphingDataHawkish2$ruler,GraphingDataHawkish2$diff_hat0 ,lty=1,lwd=2,col="black")
polygon(x=c(GraphingDataHawkish2$ruler, rev(GraphingDataHawkish2$ruler)),
        y = c(GraphingDataHawkish2$diff_lo0, rev(GraphingDataHawkish2$diff_hi0)),
        col=rgb(.25,.25,.25,.25), border=NA)





plot(c(-.25,1.25),c(-.6,.6),type="n",xaxt="n", yaxt="n", xlab="", ylab="")
x<-c(-.35,2.2)
y<-c(0,0)
lines (x,y,lty="solid", col="black")
axis(1, at=c(0,1), labels=c("Civilian","Military"),cex=1)
axis(2, at=c(-.5,0,.5),cex.axis=1)


arrows(0,GraphingDataMil$diff_lo0,0, GraphingDataMil$diff_hi0,code=3,angle=90,col="black",lwd=1.25)
points(0,GraphingDataMil$diff_hat0,pch=19,col="black",cex=1.5)

arrows(1,GraphingDataMil$diff_lo01,1, GraphingDataMil$diff_hi01,code=3,angle=90,col="black",lwd=1.25)
points(1,GraphingDataMil$diff_hat01,pch=19,col="black",cex=1.5)




}

par(op)

op <- par(usr=c(0,1,0,1), # Reset the coordinates
          xpd=NA)

legend(.375,.0, c("Electorally Accountable", "Term Limited","Pr(Conflict|Term Limited) - Pr(Conflict|Accountable)"), bty="n", cex=.75,col=c("red","blue","black"),
        lty=c(-1,-1,-1),pch=c(15,18,19), ncol=1)





## Graph for Decade Fixed Effects

GraphingDataHawkish <- read.dta("/Users/Jeff/Dropbox/TermLimits/D6/Analysis/Models/Index/Conditional/FixedEffects/Decade/Confounding/PredictedValues.dta")
GraphingDataHawkish2 <- read.dta("/Users/Jeff/Dropbox/TermLimits/D6/Analysis/Models/Index2/Conditional/FixedEffects/Decade/Confounding/PredictedValues.dta")
GraphingDataMil <- read.dta("/Users/Jeff/Dropbox/TermLimits/D6/Analysis/Models/Conditional/FixedEffects/Decade/Confounding/PredictedValues.dta")

op <- par(mfrow = c(2,3), oma=c(5,2,0,0))
{
    
plot(c(.75,5.25),c(0,.8),type="n",xaxt="n", yaxt="n", xlab="", ylab="")
mtext("Pr(Conflict Initiation)", side=2,line=3,cex=1)
axis(1, at=c(1,5), labels=c("Dove","Hawk"),cex=1)
axis(2, at=c(0,.4,.8),cex.axis=1)
mtext("Theoretical", side=3,line=1,cex=1)

lines(GraphingDataHawkish$ruler,GraphingDataHawkish$prob_hat0,lty=2,lwd=2,col="red")

polygon(x=c(GraphingDataHawkish$ruler, rev(GraphingDataHawkish$ruler)),
        y = c(GraphingDataHawkish$lo0, rev(GraphingDataHawkish$hi0)),
        col=rgb(1,.25,0,.25), border=NA)


lines(GraphingDataHawkish$ruler,GraphingDataHawkish$prob_hat1,lty=3,lwd=2,col="blue")

polygon(x=c(GraphingDataHawkish$ruler, rev(GraphingDataHawkish$ruler)),
        y = c(GraphingDataHawkish$lo1, rev(GraphingDataHawkish$hi1)),
        col=rgb(0,.25,1,.25), border=NA)



plot(c(.75,4.25),c(0,.8),type="n",xaxt="n", yaxt="n", xlab="", ylab="")
axis(1, at=c(1,4), labels=c("Dove","Hawk"),cex=1)
axis(2, at=c(0,.4,.8),cex.axis=1)
mtext("Empirical", side=3,line=1,cex=1)

lines(GraphingDataHawkish2$ruler,GraphingDataHawkish2$prob_hat0,lty=2,lwd=2,col="red")

polygon(x=c(GraphingDataHawkish2$ruler, rev(GraphingDataHawkish2$ruler)),
        y = c(GraphingDataHawkish2$lo0, rev(GraphingDataHawkish2$hi0)),
        col=rgb(1,.25,0,.25), border=NA)


lines(GraphingDataHawkish2$ruler,GraphingDataHawkish2$prob_hat1,lty=3,lwd=2,col="blue")

polygon(x=c(GraphingDataHawkish2$ruler, rev(GraphingDataHawkish2$ruler)),
        y = c(GraphingDataHawkish2$lo1, rev(GraphingDataHawkish2$hi1)),
        col=rgb(0,.25,1,.25), border=NA)





plot(c(-5,5),c(0,.8),type="n",xaxt="n", yaxt="n", xlab="", ylab="")
axis(1, at=c(-2.5,2.5), labels=c("Civilian","Military"),cex=1)
axis(2, at=c(0,.4,.8),cex.axis=1)
mtext("Military Service", side=3,line=1,cex=1)

arrows(-3.5,GraphingDataMil$lo0,-3.5, GraphingDataMil$hi0,code=3,angle=90,col="black",lwd=1)
arrows(-1.5,GraphingDataMil$lo1,-1.5, GraphingDataMil$hi1,code=3,angle=90,col="black",lwd=1)
points(-3.5,GraphingDataMil$prob_hat0,pch=15,col="red",cex=2)
points(-1.5,GraphingDataMil$prob_hat1,pch=18,col="blue",cex=2)

arrows(1.5,GraphingDataMil$lo01,1.5, GraphingDataMil$hi01,code=3,angle=90,col="black",lwd=1)
arrows(3.5,GraphingDataMil$lo11,3.5, GraphingDataMil$hi11,code=3,angle=90,col="black",lwd=1)
points(1.5,GraphingDataMil$prob_hat01,pch=15,col="red",cex=2)
points(3.5,GraphingDataMil$prob_hat11,pch=18,col="blue",cex=2)





plot(c(.75,5.25),c(-.6,.6),type="n",xaxt="n", yaxt="n", xlab="", ylab="")
mtext("Difference", side=2,line=3,cex=1)
axis(1, at=c(1,5), labels=c("Dove","Hawk"),cex=1)
axis(2, at=c(-.5,0,.5),cex.axis=1)
abline(h =0, col="black")

lines(GraphingDataHawkish$ruler,GraphingDataHawkish$diff_hat0 ,lty=1,lwd=2,col="black")
polygon(x=c(GraphingDataHawkish$ruler, rev(GraphingDataHawkish$ruler)),
        y = c(GraphingDataHawkish$diff_lo0, rev(GraphingDataHawkish$diff_hi0)),
        col=rgb(.25,.25,.25,.25), border=NA)




plot(c(.75,4.25),c(-.6,.6),type="n",xaxt="n", yaxt="n", xlab="", ylab="")
axis(1, at=c(1,4), labels=c("Dove","Hawk"),cex=1)
axis(2, at=c(-.5,0,.5),cex.axis=1)
abline(h =0, col="black")

lines(GraphingDataHawkish2$ruler,GraphingDataHawkish2$diff_hat0 ,lty=1,lwd=2,col="black")
polygon(x=c(GraphingDataHawkish2$ruler, rev(GraphingDataHawkish2$ruler)),
        y = c(GraphingDataHawkish2$diff_lo0, rev(GraphingDataHawkish2$diff_hi0)),
        col=rgb(.25,.25,.25,.25), border=NA)





plot(c(-.25,1.25),c(-.6,.6),type="n",xaxt="n", yaxt="n", xlab="", ylab="")
x<-c(-.35,2.2)
y<-c(0,0)
lines (x,y,lty="solid", col="black")
axis(1, at=c(0,1), labels=c("Civilian","Military"),cex=1)
axis(2, at=c(-.5,0,.5),cex.axis=1)


arrows(0,GraphingDataMil$diff_lo0,0, GraphingDataMil$diff_hi0,code=3,angle=90,col="black",lwd=1.25)
points(0,GraphingDataMil$diff_hat0,pch=19,col="black",cex=1.5)

arrows(1,GraphingDataMil$diff_lo01,1, GraphingDataMil$diff_hi01,code=3,angle=90,col="black",lwd=1.25)
points(1,GraphingDataMil$diff_hat01,pch=19,col="black",cex=1.5)




}

par(op)

op <- par(usr=c(0,1,0,1), # Reset the coordinates
          xpd=NA)

legend(.375,.0, c("Electorally Accountable", "Term Limited","Pr(Conflict|Term Limited) - Pr(Conflict|Accountable)"), bty="n", cex=.75,col=c("red","blue","black"),
        lty=c(-1,-1,-1),pch=c(15,18,19), ncol=1)









## Graph for Regional Fixed Effects

GraphingDataHawkish <- read.dta("/Users/Jeff/Dropbox/TermLimits/D6/Analysis/Models/Index/Conditional/FixedEffects/Region/Confounding/PredictedValues.dta")
GraphingDataHawkish2 <- read.dta("/Users/Jeff/Dropbox/TermLimits/D6/Analysis/Models/Index2/Conditional/FixedEffects/Region/Confounding/PredictedValues.dta")
GraphingDataMil <- read.dta("/Users/Jeff/Dropbox/TermLimits/D6/Analysis/Models/Conditional/FixedEffects/Region/Confounding/PredictedValues.dta")

op <- par(mfrow = c(2,3), oma=c(5,2,0,0))
{
    
plot(c(.75,5.25),c(0,.8),type="n",xaxt="n", yaxt="n", xlab="", ylab="")
mtext("Pr(Conflict Initiation)", side=2,line=3,cex=1)
axis(1, at=c(1,5), labels=c("Dove","Hawk"),cex=1)
axis(2, at=c(0,.4,.8),cex.axis=1)
mtext("Theoretical", side=3,line=1,cex=1)

lines(GraphingDataHawkish$ruler,GraphingDataHawkish$prob_hat0,lty=2,lwd=2,col="red")

polygon(x=c(GraphingDataHawkish$ruler, rev(GraphingDataHawkish$ruler)),
        y = c(GraphingDataHawkish$lo0, rev(GraphingDataHawkish$hi0)),
        col=rgb(1,.25,0,.25), border=NA)


lines(GraphingDataHawkish$ruler,GraphingDataHawkish$prob_hat1,lty=3,lwd=2,col="blue")

polygon(x=c(GraphingDataHawkish$ruler, rev(GraphingDataHawkish$ruler)),
        y = c(GraphingDataHawkish$lo1, rev(GraphingDataHawkish$hi1)),
        col=rgb(0,.25,1,.25), border=NA)



plot(c(.75,4.25),c(0,.8),type="n",xaxt="n", yaxt="n", xlab="", ylab="")
axis(1, at=c(1,4), labels=c("Dove","Hawk"),cex=1)
axis(2, at=c(0,.4,.8),cex.axis=1)
mtext("Empirical", side=3,line=1,cex=1)

lines(GraphingDataHawkish2$ruler,GraphingDataHawkish2$prob_hat0,lty=2,lwd=2,col="red")

polygon(x=c(GraphingDataHawkish2$ruler, rev(GraphingDataHawkish2$ruler)),
        y = c(GraphingDataHawkish2$lo0, rev(GraphingDataHawkish2$hi0)),
        col=rgb(1,.25,0,.25), border=NA)


lines(GraphingDataHawkish2$ruler,GraphingDataHawkish2$prob_hat1,lty=3,lwd=2,col="blue")

polygon(x=c(GraphingDataHawkish2$ruler, rev(GraphingDataHawkish2$ruler)),
        y = c(GraphingDataHawkish2$lo1, rev(GraphingDataHawkish2$hi1)),
        col=rgb(0,.25,1,.25), border=NA)





plot(c(-5,5),c(0,.8),type="n",xaxt="n", yaxt="n", xlab="", ylab="")
axis(1, at=c(-2.5,2.5), labels=c("Civilian","Military"),cex=1)
axis(2, at=c(0,.4,.8),cex.axis=1)
mtext("Military Service", side=3,line=1,cex=1)

arrows(-3.5,GraphingDataMil$lo0,-3.5, GraphingDataMil$hi0,code=3,angle=90,col="black",lwd=1)
arrows(-1.5,GraphingDataMil$lo1,-1.5, GraphingDataMil$hi1,code=3,angle=90,col="black",lwd=1)
points(-3.5,GraphingDataMil$prob_hat0,pch=15,col="red",cex=2)
points(-1.5,GraphingDataMil$prob_hat1,pch=18,col="blue",cex=2)

arrows(1.5,GraphingDataMil$lo01,1.5, GraphingDataMil$hi01,code=3,angle=90,col="black",lwd=1)
arrows(3.5,GraphingDataMil$lo11,3.5, GraphingDataMil$hi11,code=3,angle=90,col="black",lwd=1)
points(1.5,GraphingDataMil$prob_hat01,pch=15,col="red",cex=2)
points(3.5,GraphingDataMil$prob_hat11,pch=18,col="blue",cex=2)





plot(c(.75,5.25),c(-.6,.6),type="n",xaxt="n", yaxt="n", xlab="", ylab="")
mtext("Difference", side=2,line=3,cex=1)
axis(1, at=c(1,5), labels=c("Dove","Hawk"),cex=1)
axis(2, at=c(-.5,0,.5),cex.axis=1)
abline(h =0, col="black")

lines(GraphingDataHawkish$ruler,GraphingDataHawkish$diff_hat0 ,lty=1,lwd=2,col="black")
polygon(x=c(GraphingDataHawkish$ruler, rev(GraphingDataHawkish$ruler)),
        y = c(GraphingDataHawkish$diff_lo0, rev(GraphingDataHawkish$diff_hi0)),
        col=rgb(.25,.25,.25,.25), border=NA)




plot(c(.75,4.25),c(-.6,.6),type="n",xaxt="n", yaxt="n", xlab="", ylab="")
axis(1, at=c(1,4), labels=c("Dove","Hawk"),cex=1)
axis(2, at=c(-.5,0,.5),cex.axis=1)
abline(h =0, col="black")

lines(GraphingDataHawkish2$ruler,GraphingDataHawkish2$diff_hat0 ,lty=1,lwd=2,col="black")
polygon(x=c(GraphingDataHawkish2$ruler, rev(GraphingDataHawkish2$ruler)),
        y = c(GraphingDataHawkish2$diff_lo0, rev(GraphingDataHawkish2$diff_hi0)),
        col=rgb(.25,.25,.25,.25), border=NA)





plot(c(-.25,1.25),c(-.6,.6),type="n",xaxt="n", yaxt="n", xlab="", ylab="")
x<-c(-.35,2.2)
y<-c(0,0)
lines (x,y,lty="solid", col="black")
axis(1, at=c(0,1), labels=c("Civilian","Military"),cex=1)
axis(2, at=c(-.5,0,.5),cex.axis=1)


arrows(0,GraphingDataMil$diff_lo0,0, GraphingDataMil$diff_hi0,code=3,angle=90,col="black",lwd=1.25)
points(0,GraphingDataMil$diff_hat0,pch=19,col="black",cex=1.5)

arrows(1,GraphingDataMil$diff_lo01,1, GraphingDataMil$diff_hi01,code=3,angle=90,col="black",lwd=1.25)
points(1,GraphingDataMil$diff_hat01,pch=19,col="black",cex=1.5)




}

par(op)

op <- par(usr=c(0,1,0,1), # Reset the coordinates
          xpd=NA)

legend(.375,.0, c("Electorally Accountable", "Term Limited","Pr(Conflict|Term Limited) - Pr(Conflict|Accountable)"), bty="n", cex=.75,col=c("red","blue","black"),
        lty=c(-1,-1,-1),pch=c(15,18,19), ncol=1)






## Graphs for Types of Military Career

op <- par(mfrow = c(1,1), oma=c(5,2,0,0))
{

GraphingData <- read.dta("/Users/Jeff/Dropbox/TermLimits/D6/Analysis/Models/Conditional/MilitaryCareer/Confounding/PredictedValues.dta")
    
plot(c(-.25,2.25),c(-.4,.4),type="n",xaxt="n", yaxt="n", xlab="", ylab="")
x<-c(-.35,2.35)
y<-c(0,0)
lines (x,y,lty="solid", col="black")
axis(1, at=c(0,1,2), labels=c("Civilian","Career","Non-Career"),cex=1)
axis(2, at=c(-.4,-.2,0,.2,.4),cex.axis=1)
mtext("Military Career Model", side=3,line=1,cex=1)
mtext("Pr(Initiation|Lame Duck) - Pr(Initiation|Accountable)", side=2,line=3,cex=1)

   

arrows(0,GraphingData$diff_lo0,0, GraphingData$diff_hi0,code=3,angle=90,col="black",lwd=1.25)
points(0,GraphingData$diff_hat0,pch=19,col="black",cex=1.5)

arrows(1,GraphingData$diff_lo01,1, GraphingData$diff_hi01,code=3,angle=90,col="black",lwd=1.25)
points(1,GraphingData$diff_hat01,pch=19,col="black",cex=1.5)

arrows(2,GraphingData$diff_lo02,2, GraphingData$diff_hi02,code=3,angle=90,col="black",lwd=1.25)
points(2,GraphingData$diff_hat02,pch=19,col="black",cex=1.5)



}


par(op)

op <- par(usr=c(0,1,0,1), # Reset the coordinates
          xpd=NA)


legend(.25,.05, c("Pr(Initiation|Lame Duck) - Pr(Initiation|Accountable)","95% Confidence Interval"), bty="n", cex=1,col=c("black","black"),
        lty=c(-1,1),pch=c(19,-1))






## Graphs for Types of Service

op <- par(mfrow = c(1,1), oma=c(5,2,0,0))
{

GraphingData <- read.dta("/Users/Jeff/Dropbox/TermLimits/D5/Analysis/Models/ServiceType/Confounding/PredictedValues.dta")
    
plot(c(-.25,2.25),c(-.4,.4),type="n",xaxt="n", yaxt="n", xlab="", ylab="")
x<-c(-.35,2.35)
y<-c(0,0)
lines (x,y,lty="solid", col="black")
axis(1, at=c(0,1,2), labels=c("Civilian","Non-Combat","Combat"),cex=1)
axis(2, at=c(-.4,-.2,0,.2,.4),cex.axis=1)
mtext("Military Service Model", side=3,line=1,cex=1)
mtext("Pr(Initiation|Lame Duck) - Pr(Initiation|Accountable)", side=2,line=3,cex=1)

   

arrows(0,GraphingData$diff_lo0,0, GraphingData$diff_hi0,code=3,angle=90,col="black",lwd=1.25)
points(0,GraphingData$diff_hat0,pch=19,col="black",cex=1.5)

arrows(1,GraphingData$diff_lo01,1, GraphingData$diff_hi01,code=3,angle=90,col="black",lwd=1.25)
points(1,GraphingData$diff_hat01,pch=19,col="black",cex=1.5)

arrows(2,GraphingData$diff_lo02,2, GraphingData$diff_hi02,code=3,angle=90,col="black",lwd=1.25)
points(2,GraphingData$diff_hat02,pch=19,col="black",cex=1.5)



}


par(op)

op <- par(usr=c(0,1,0,1), # Reset the coordinates
          xpd=NA)


legend(.25,.05, c("Pr(Initiation|Lame Duck) - Pr(Initiation|Accountable)","95% Confidence Interval"), bty="n", cex=1,col=c("black","black"),
        lty=c(-1,1),pch=c(19,-1))


